package cn.edu.lzu.dao;

import cn.edu.lzu.entity.ClinicExamineItem;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @PackageName: cn.edu.lzu.dao
 * @InterfaceName: ClinicExamineItemMapper
 * @Description: TODO
 * @Author: 张琦[QQ:3098086691]
 * @Date: 2020/3/29 18:30
 * @Version: 1.0
 */
@Mapper
public interface ClinicExamineItemMapper {
    @Select("select * from clinic_examine_item where is_deleted=0 and unit_id=#{unitId} limit #{startIndex}, #{pageSize}")
    List<ClinicExamineItem> selCliItemByUnitId(long unitId, int startIndex, int pageSize);

    @Select("select count(*) from clinic_examine_item where is_deleted=0 and unit_id=#{unitId}")
    int selCliItemTotalCount(long unitId);

    @Update("update clinic_examine_item set is_deleted=1 where examine_item_id=#{examineItemId}")
    int updDeleteCliItemById(int examineItemId);

    @Insert("insert into clinic_examine_item (examine_item_id, examine_name, item_type, price, apply_sex, apply_range, unit_id, is_deleted) values(default, #{examineName}, #{itemType}, #{price}, #{applySex}, #{applyRange}, #{unitId}, 0)")
    int insAddCliItem(ClinicExamineItem clinicExamineItem);

    @Select("select * from clinic_examine_item where is_deleted=0 and unit_id=#{unitId}")
    List<ClinicExamineItem> selAllCliItems(long unitId);

    @Select("select * from clinic_examine_item where is_deleted=0 and examine_item_id=#{examineItemId}")
    ClinicExamineItem selByExamineItemId(int examineItemId);
}
